package com.cskaoyan.shiro;


import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author Pudding
 * @Date 2024/6/15 10:04
 */
@Component
public class ShiroJSessionIdResolverFilter extends OncePerRequestFilter {

    @Override
    protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
        //获取的带有jsessionId的url
        String uri = request.getRequestURI();
        if (uri.startsWith("/wx/auth/unAuthc;")) {
            //请求转发到下面的这个路径
            request.getRequestDispatcher("/wx/auth/unAuthc").forward(request, response);
            return;
        }
        filterChain.doFilter(request, response);
    }
}
